#include "um_pt.h"


static PT_Class *pt_current_thread;

LIST_HEAD(pt_head_thread);

void pt_thread_init()
{
	//LIST_HEAD(pt_thread_head);
}

int pt_thread_add(PT_Class *thread, char (*entry)(PT *parameter))
{
    thread->entry = entry;
    PT_INIT(&thread->pt);
    list_add_tail(&thread->list, &pt_head_thread);
    return true;
}

void pt_thread_scheduler(void)
{
    list_for_each_entry(pt_current_thread, PT_Class,&pt_head_thread,  list)
    {
        if (pt_current_thread != NULL)
        {
            pt_current_thread->entry(&pt_current_thread->pt);
        }
    }
}
